import router from '@router';

const homeTabBar = {
  list: {
    items: [
      {
        content: {
          value: '首页',
          fontSize: 10
        },
        icon: {
          font: 'bp-icon bz-f-12 bp-icon-home',
          activeFont: 'bz-t-base',
          style: 'width:20px;height:20px;',
          direction: 'top'
        },
        to: '/',
        className: 'bz-pd-5 bz-bd-r-e5e'
      },
      {
        content: {
          value: '商家',
          fontSize: 10
        },
        icon: {
          font: 'bp-icon bz-f-12 bp-icon-home',
          activeFont: 'bz-t-base',
          style: 'width:20px;height:20px;',
          direction: 'bottom'
        },
        to: '/merchant',
        className: 'bz-pd-5 bz-bd-r-e5e',
        fontSize: 10
      },
      {
        content: {
          value: '购物车',
          fontSize: 10
        },
        icon: {
          font: 'bp-icon bz-f-12 bp-icon-menu',
          activeFont: 'bz-t-base',
          direction: 'top',
          style: 'width:20px;height:20px;',
        },
        to: '/cart',
        className: 'bz-pd-5 bz-bd-r-e5e'
      },
      {
        content: {
          value: '个人中心',
          fontSize: 10
        },
        icon: {
          font: 'bp-icon bz-f-12 bp-icon-menu',
          activeFont: 'bz-t-base',
          direction: 'top',
          style: 'width:20px;height:20px;'
        },
        to: '/grzx',
        className: 'bz-pd-5'
      }
    ]
  },
  active() {
    if (router.$matchRoutes([/^\/merchant.*/])) {
      this.activeIndex = 1;
    }else if(router.$matchRoutes([/^\/cart.*/])) {
      this.activeIndex = 2;
    }else if(router.$matchRoutes([/^\/grzx.*/])) {
      this.activeIndex = 3;
    }else {
      this.activeIndex = 0;
    }
  }
};

export default homeTabBar;
